Many image sensors of today are so-called Bayer sensors. A Bayer sensor outputs an image matrix, in which color channels (red, green and blue) are sub-sampled in a way that every other row contains pixels with red (R) and green (G1) channel intensity values and the remaining rows contain pixels with blue (B) and green (G2) channel intensity values. The intensity values of the individual color channels will be referred to as color values from here on. Consequently, every pixel contains only one color value, as indicated in the schematic image below:
      (                            R                                      G            1                                    R                                      G            1                                    R                                      G            1                                    R                          ⋯                                                  G            2                                    B                                      G            2                                    B                                      G            2                                    B                                      G            2                                    ⋯                                      R                                      G            1                                    R                                      G            1                                    R                                      G            1                                    R                          ⋯                                                  G            2                                    B                                      G            2                                    B                                      G            2                                    B                                      G            2                                    ⋯                                      R                                      G            1                                    R                                      G            1                                    R                                      G            1                                    R                          ⋯                                                  G            2                                    B                                      G            2                                    B                                      G            2                                    B                                      G            2                                    ⋯                                      R                                      G            1                                    R                                      G            1                                    R                                      G            1                                    R                          ⋯                                      ⋯                          ⋯                          ⋯                          ⋯                          ⋯                          ⋯                          ⋯                          ⋯                      )     
In order to achieve an image with every pixel having color values for all three color channels, i.e. a full RGB (Red, Green, Blue) image, some sort of image processing or reconstruction must be made. Usually, a missing color value in a pixel is determined on the basis of the color values in the nearby pixels, e.g. a pixel in position (X,Y) having only a red value may take the blue value in the pixels placed in the positions (X−1,Y−1), (X−1,Y+1), (X+1,Y+1) and (X+1,Y−1) into consideration when determining the blue value for the present pixel placed in position (X,Y), and in a similar way the green value is determined. This type of operation is often referred to as color interpolation.
Color interpolation works fine when the color values vary smoothly between adjacent pixels, but at sharp edges, i.e. when the color values change drastically between adjacent pixels, care must be taken to avoid unwanted artifacts.
One type of artifact is blurring of sharp edges. Another type of artifact is the so-called zipper effect, where a pattern of alternating low and high intensity values is produced along horizontal and vertical edges. Yet another type of artifact is the appearance of so-called color fringes, which arise when edges are reproduced differently among the color channels. Hence, colored fringes are produced near sharp edges. Still another type of artifact is the so-called maze pattern, caused by incorrectly detected edges in the presence of noise or difference in response between G1 and G2 pixel elements.
One known solution for reducing blurring and color fringes is to interpolate inter-channel differences, rather than interpolating the color channels individually. However, this method produces zipper artifacts.
Another known solution for reducing blurring, zipper effects and color fringes is to determine whether there is a vertical or horizontal structure in the image, which is done by determining vertical and horizontal gradient values in the image. Based on the structure of the image the interpolation is adjusted in order to achieve a better image. However, this method produces maze artifacts and poorly reproduces diagonal structures.
Although some of the aforementioned artifacts are mitigated by the above mentioned methods, these methods are not optimal. In particular, they can not simultaneously eliminate or at least significantly reduce blurring, zipper artifacts, color fringes and maze artifacts.